<template>
	<view class="newsList-page">
		<!-- 循环遍历 list 数组 -->
		<view class="new-block" v-for="(item, index) in list" :key="index"
			@click="navigate('/page_pack/news_detail/news_detail?id='+item.id)">
			<view class="new-title">{{item.subject}}</view>
			<view class="time-item">
				<view class="new-text">{{item.noticeTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => [] // 默认值改为空数组更合适
			},
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url: url
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.newsList-page {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 30rpx;

		.new-block {
			margin-bottom: 30rpx;
			padding-bottom: 30rpx;
			border-bottom: 1rpx solid #f0f0f0; // 添加间隔线

			// 最后一个元素不需要间隔线
			&:last-child {
				border-bottom: none;
				padding-bottom: 0;
			}

			.new-title {
				font-size: 32rpx;
				margin-bottom: 20rpx;
			}

			.time-item {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.new-text {
					font-size: 28rpx;
					color: #767676;
				}
			}
		}
	}
</style>